home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Games / Tetris / Source / Piece.h < prev    next >
Text File  |  1972-08-28  |  1KB  |  69 lines

  1.  
  2. #import <objc/Object.h>
  3.  
  4. #define MAX_SHAPE_SIZE    4
  5. #define PIECE_INFO_NULL    (struct pieceInfo *)0
  6. #define NUM_BITMAPS    4
  7.  
  8. struct shape {
  9.     unsigned char table[4][4];
  10.     unsigned char bounds[4];
  11.     unsigned char points[4];
  12. };
  13.  
  14. struct pieceInfo {
  15.     id bitmap;
  16.     int shape;
  17.     int rotation;
  18. };
  19.  
  20. @interface Piece:Object
  21. {
  22.     int curRow, curCol;              // The Block's position
  23.     id bitmap;                          // The image used to build the block
  24.     unsigned char *currentPiece;
  25.     struct shape *currentShape;
  26.     int shapenum;                      // The Shape that we are currently dropping
  27.     int currentRotation;
  28.     int dropPoints;                  // Bonus points for dropping the piece
  29.     NXSize blockSize;
  30.     NXSize intercell;
  31.     NXRect invalidRect;
  32.  
  33.     BOOL viewVarsInited;
  34.     id anmShape;
  35.     id anmBackground;              // The animation background
  36.     struct shape shapes[7];
  37.      id blockImage[NUM_BITMAPS]; // Holds the id for each block image.
  38. }
  39.  
  40. - init;
  41.  
  42. - draw:sender;
  43. - (BOOL)reset:sender piece:(struct pieceInfo *)info;
  44. - newPiece;
  45. - (struct pieceInfo *)pieceInfo;
  46. - setPiece:(struct pieceInfo *)info;
  47.  
  48. - (BOOL)legalMove:sender :(int)row :(int)column rotation:(int)rotation;
  49.  
  50. - left:sender;
  51. - right:sender;
  52.  
  53. - getInvalidRect:(NXRect *)aRect for:sender;
  54. - point:(NXPoint *)thePoint for:(int)row :(int)column;
  55. - (int)points;
  56. - getBlockSize:(NXSize *) size;
  57. - getBlockImage:(int) blockNum;
  58.  
  59. - drop:sender;
  60. - (BOOL)down:sender;
  61. - turn:sender;
  62. - stick:sender;
  63.  
  64. - (int)getCurRow;
  65.  
  66. - free;
  67.  
  68. @end
  69.